/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ivanbiz.dao.impl;

import com.ivanbiz.dao.InternalDeliveryItemDAO;
import com.ivanbiz.helper.HibernateUtil;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author Administrator
 */
public class InternalDeliveryItemDAOImpl extends GenericDAOImpl implements InternalDeliveryItemDAO {

    @Override
    public List getDataByLike(String variable1, Object input1, String variable2, Object input2) throws Exception {
        try {
            Session session = HibernateUtil.getSession();
            Query queryOrder = session.createQuery("from com.ivanbiz.model.InternalDeliveryItem poi where poi." + variable1 + " in ( select po." + variable1 + " from com.ivanbiz.model.InternalDelivery po where po." + variable1 + " like '%" + input1 + "%' and po." + variable2 + " = '" + input2 + "')");
            List list = queryOrder.list();
            return list;
        } catch (Exception e) {
            HibernateUtil.rollbackTransaction();
            throw e;
        } finally {
            HibernateUtil.closeSession();
        }
    }
}
